#include <iostream>
using namespace std;
int main()
{
	int n = 0;
	while (cin >> n)
	{
		int cnt = 0;
		while (n != 0)
		{
			n &= (n - 1);
			++cnt;
		}
		cout << cnt << endl;
	}
	return 0;
}